package com.gongqi.base.utils;

import lombok.Data;

@Data
public class R {
    private boolean success = true; //默认操作成功
    private String message = "操作成功！"; //默认的提示信息
    private Object result;
    public static R me(){
        return new R();
    }

    public boolean isSuccess() {
        return success;
    }

    //是一个普通方法，被类对象来调用
    public R setSuccess(boolean success) {
        this.success = success;
        return this; //谁调用我，我就是谁
    }

    public String getMessage() {
        return message;
    }

    public R setResult(Object result) {
        this.result = result;
        return this;
    }

    public R setMessage(String message) {
        this.message = message;
        return this;
    }

    public R(boolean success, String message) {
        this.success = success;
        this.message = message;
    }

    public R() {
    }

    @Override
    public String toString() {
        return "AjaxResult{" +
                "success=" + success +
                ", message='" + message + '\'' +
                '}';
    }
}
